<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>鑫多多</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../css/mui.min.css">
	
		<style>
			html,body {
				background-color: #efeff4;
			}
			.title{
				margin: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
			}
		</style>
	</head>

	<body ng-app="mainApp" ng-controller="myOwnCtrl" >
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">{{user.realName}}</h1>
		</header>
		<div class="mui-content">
			<!--<div class="title">
				您好，欢迎进入我的页面。
			</div>-->
			
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" ng-click="shopingCartList()">
						购物车
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" ng-click="orderList()">
						订单
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" ng-click="couponList()">
						优惠券
					</a>
				</li>
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-collapse">
					<a class="mui-navigate-right" href="#">旧物回收</a>
					<div class="mui-collapse-content">
						<form class="mui-input-group">
							<div class="mui-input-row" ng-click="oldGoodsList()">
								<label >案例展示</label>
							</div>
							<div class="mui-input-row" ng-click="oldhssm()">
								<label>回收说明</label>
							</div>
							<div class="mui-input-row " ng-click="oldhsczsm()">
								<label>操作说明</label>
							</div>
							<div class="mui-input-row " ng-click="myOld()">
								<label>我的旧物</label>
							</div>
							<div class="mui-input-row " ng-click="oldTijiao()">
								<label>旧物提交</label>
							</div>
						</form>
					</div>
				</li>
				
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell mui-collapse">
					<a class="mui-navigate-right" href="#">系统消息 &nbsp; &nbsp;<span id="xtCount"></span></a>
					<div class="mui-collapse-content">
						<form class="mui-input-group">
							<div class="mui-input-row" ng-click="qfReadList('0')">
								<label >未读消息&nbsp;<span id="qfCount"></span></label>
							</div>
							<div class="mui-input-row" ng-click="qfReadList('1')">
								<label>历史记录</label>
							</div>
						</form>
					</div>
				</li>
				
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" ng-click="updatePwd()">
						修改密码
					</a>
				</li>
			</ul>
			<!--<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					 <a href="http://p.qiao.baidu.com/cps/chat?siteId=12027528&userId=25610371"><img src="../images/goodsDefault.gif"/></a>
				</li>
			</ul>-->
		</div>
	</body>
	<script src="../js/mui.min.js"></script>
	<script src="../js/angular/angular.min.js"></script>
	<script src="../js/angular/angular-resource.js"></script>
	<script src="../js/angular/common.js"></script>
	<script src="../js/common.js"></script>
	<script src="../js/service/userService.js"></script>



	<script>
		window.addEventListener('refresh', function(e){//执行刷新
    		location.reload();
    		// 获取当前webview
			var self = plus.webview.currentWebview();
			var opener = self.opener();
			//此句调用父页面js
			opener.evalJS('getQfCount()');
    	});
		mui.init();
		mainApp.controller('myOwnCtrl', function($scope,userService) {
			(function($, doc) {
				$.init({
					statusBarBackground: '#f7f7f7'
				});
				
				//我的群消息
				var url=baseUrl+"/mapi/msgGroup/getNoReadQF";
				function getQfCount() {
					mui.ajax(url,{
					    dataType:'json',//服务器返回json格式数据
					    type:'get',//HTTP请求类型	
					    timeout:10000,//超时时间设置为10秒；
					    headers:{'Content-Type':'application/json'},                  
					    success:function(data){
					    	if(data.data!=null&&data.data>0){
					    		document.getElementById("qfCount").innerHTML="<span class='mui-badge' >"+data.data+"</span>";
					    		document.getElementById("xtCount").innerHTML="<span class='mui-badge' >"+data.data+"</span>";
					    	}else{
					    		document.getElementById("qfCount").innerHTML="";
					    		document.getElementById("xtCount").innerHTML="";
					    	}
					    },
					    error:error
					});
				}
			getQfCount();
				//我的购物车
				$scope.shopingCartList=function(){
					$.openWindow({
						url: 'shoppingCart.html',
						id: 'shoppingCart'+new Date().getMilliseconds(),
						preload: true,
						show: {
							aniShow: 'pop-in'
						},
						waiting: {
							autoShow: false
						}
					});
				}
				//订单
				$scope.orderList=function(){
					$.openWindow({
						url: 'orderList.html',
						id: 'orderList'+new Date().getMilliseconds(),
						preload: true,
						show: {
							aniShow: 'pop-in'
						},
						waiting: {
							autoShow: false
						}
					});
				}
				$scope.oldGoodsList=function(){
					$.openWindow({
						url: 'oldGoods.html',
						id: 'oldGoods'+ new Date().getMilliseconds(),
						preload: true,
						show: {
							aniShow: 'pop-in'
						},
						waiting: {
							autoShow: false
						}
					});
				}
				$scope.oldhssm=function(){
					mui.openWindow({
						url:'xieyi.html',
						id:'xieyi',
						extras:{//参数传递
							xyType:'hssm'
						}
					});
				}
				$scope.oldhsczsm=function(){
					mui.openWindow({
						url:'xieyi.html',
						id:'xieyi',
						extras:{//参数传递
							xyType:'czsm'
						}
					});
				}
				
				$scope.oldTijiao=function(){
					mui.openWindow({
					//	url:'oldSell.html',
					//	id:'oldSell',
						url:'oldSell.html',
						id:'oldSell'+ new Date().getMilliseconds(),
						extras:{//参数传递
						}
					});
				}
				//我的优惠券
				$scope.myOld=function(){
					mui.openWindow({
						url:'myOld.html',
						id:'myOld'+ new Date().getMilliseconds(),
						extras:{}
					});
				}
				//我的优惠券
				$scope.couponList=function(){
					mui.openWindow({
						url:'couponlist.html',
						id:'couponlist'+ new Date().getMilliseconds(),
						extras:{}
					});
				}
				//修改密码
				$scope.updatePwd=function(){
					mui.openWindow({
						url:'updatePwd.html',
						id:'updatePwd',
						extras:{}
					});
				}
				
				$scope.qfReadList=function(state){
					mui.openWindow({
						url:'qfMsgList.html',
						id:'qfMsgList'+ new Date().getMilliseconds(),
						extras:{state:state}
					});
				}
				
				userService.getUserDetail(function(data){
					$scope.user=data.data;
				},error)
				
			}(mui, document));
			
		});
	</script>
</html>